<template>
    <div :id="props.id"></div>
</template>
<script setup>
import { onMounted } from "vue";
import * as echarts from 'echarts'
const props = defineProps(['option','id'])
const option = props.option

onMounted(()=> {
    let myChart = echarts.init(document.getElementById(props.id));
    // 绘制图表
    console.log(option)
    myChart.setOption(option);
    // window.onresize = function () {//自适应大小
    //     console.log("resize")
    //     myChart.resize();
    // };
    
    window.addEventListener("resize", function () {
           setTimeout(function () {
               myChart.resize();
           }, 100)
       });

});
</script>